package configuration.dataObjects
{
	import mx.collections.ArrayCollection;
	[Bindable]
	public class FilterConfigDetailDO
	{
		public var RECORD_TYPE:String = "";
		public var FILTER_NAME:String = "";
		public var DESCRIPTION:String = "";
		public var FILTER_STATEMENT:String = "";
		public var SYSTEM_CREATED:String = "";
		public var ACTIVE:String = "";
		public var USER_STAMP:String = "";
		public var DATE_TIME_STAMP:String = "";
		public var OBJECT_ID:Number = 0;


		public function FilterConfigDetailDO():void
		{
		}	
		
		public function Init(xmlObj:XML):void{				
			if(null == xmlObj)
				return;
			else{
				for each (var itemProp:XML in xmlObj.children()) {			
					this[itemProp.name()] = itemProp;
				}
			}
		}
		
		public function ToXML():XML{
			var xmlObj:XML = 
			<FilterConfigDetailDO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">			
				<RECORD_TYPE>{RECORD_TYPE}</RECORD_TYPE>
				<FILTER_NAME>{FILTER_NAME}</FILTER_NAME>
				<DESCRIPTION>{DESCRIPTION}</DESCRIPTION>
				<FILTER_STATEMENT>{FILTER_STATEMENT}</FILTER_STATEMENT>
				<SYSTEM_CREATED>{SYSTEM_CREATED}</SYSTEM_CREATED>
				<ACTIVE>{ACTIVE}</ACTIVE>
				<USER_STAMP>{USER_STAMP}</USER_STAMP>
				<DATE_TIME_STAMP>{DATE_TIME_STAMP}</DATE_TIME_STAMP>
				<OBJECT_ID>{OBJECT_ID}</OBJECT_ID>
			</FilterConfigDetailDO>;
			return xmlObj;
		}
		
		public static function getItems(list:XMLList):ArrayCollection
		{
			var ac:ArrayCollection = new ArrayCollection();
			for each(var xml:XML in list)
			{
				var itm:FilterConfigDetailDO = new FilterConfigDetailDO();
				itm.Init(xml);
				ac.addItem(itm);
			}
			return ac;
		}
	}
}